home *** CD-ROM | disk | FTP | other *** search
- unit NoClose2Form;
-
- interface
-
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
- StdCtrls;
-
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- private
- procedure WMQueryEndSession(var Msg: TWMQueryEndSession);
- message wm_QueryEndSession;
- end;
-
- var
- Form1: TForm1;
-
- implementation
-
- {$R *.DFM}
-
- procedure TForm1.WMQueryEndSession(var Msg: TWMQueryEndSession);
- const
- Prompt = 'Allow program to close, and thereby let Windows session end?';
- begin
- LongBool(Msg.Result) :=
- MessageDlg(Prompt, mtConfirmation, [mbYes, mbNo], 0) = mrYes;
- //If it still seems okay to terminate, then call previously installed checking
- if LongBool(Msg.Result) then
- inherited;
- end;
-
- end.
-